package NetWorkTest1;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-08-16
 * Time: 17:03
 */
public class UdpDictServer extends UdpServer {
    HashMap<String,String> map = new HashMap<>();

    public UdpDictServer(int port) throws SocketException {
        super(port);
        map.put("java","java编程语言");
        map.put("JVM","java虚拟机");
        map.put("MySQL","MySQL数据库");
        map.put("Thread","线程");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request,"词典还未记录该词");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer = new UdpDictServer(8000);
        udpDictServer.start();
    }

}
